Blog search

Friday Facts #47 - CRC fun

Posted by Tomas on 2014-08-15

Hello FFF readers, another week, another set of news. Kovarex took some more vacation days for a visit to Slovakia where his relatives live. He will come back on Sunday just in time to switch places with me. I will be off for the whole next week, playing Go, hiking and relaxing in the Czech Beskydy mountains. Another fun fact is that the most active forum user ssilk took some vacation as well and he actually came to Prague. I will go meet with him tomorrow.

Friday Facts #172 - Blending and Rendering

Posted by Posila & V453000 on 2017-01-06

Alpha blending and pre-multiplied alpha From time to time there is some confusion inside the team about how sprites are blended with the background when rendering, and what kind of effects we are able to achieve by tinting the sprites. So I (Posila) have decided to write up a few paragraphs about how alpha blending works (not only in Factorio), and what it means when someone talks about pre-multiplied alpha. When the GPU is figuring out what color it should draw on a particular pixel position, it runs a blending operation on just the computed pixel color and original color in the render target. There are several common blending operation modes (additive, multiplicative, overwrite, etc.), but the most common one used in Factorio is alpha blending. It calculates the resulting color using following equation (usually the new color is called 'source' and the background color that is being overwritten is called 'destination'): You can easily see that a source with alpha 0 will be fully transparent and the one with alpha 1 will be fully opaque. In games it is common to use a pre-multiplied alpha, which means the color channels of textures are stored in memory being already pre-multiplied by the alpha channel. Alpha blending with pre-multiplied alpha uses a simplified equation: Besides a slight performance gain from the GPU not having to do bunch of multiplication all the time, this equation allow us to do some extra effects we couldn't do without pre-multiplied alpha. Factorio renders sprites as colored polygons with texture. We usually refer to the color of a polygon as the 'tint', and every pixel of a sprite is multiplied with its tint. This is useful mainly for color masks, for example the diesel locomotive has a grayscale color mask which is tinted by the color it has set. Tints should have a pre-multiplied alpha too, but they don't have to, so we can use it to lie about the colors and alpha to the GPU. For example if we use tint {r=1,g=1,b=1,a=0} we can simplify previous equation even further and we get additive blending: This is great because that means we can switch between alpha and additive blending without having to change the blending state in graphics API, which would break sprite batching and result in an increase in the CPU cost of rendering. For some effects we use a tint with alpha between 0 and 1 heavily. This makes the result appear to be a combination of additive and alpha blending. For example, fire would eventually blend into a single solid color with pure additive blending, or would not look like it is emitting light with pure alpha blending. By using tint (1, 1, 1, 0.35) on the flame sprites, the brightness of overlapping flames adds up partially, but the flames don't completely lose their details. The same trick is used for smoke. Textures with pre-multiplied alpha also produce better results in texture filtering , which is probably the main reason why they are so widely used in the videogame industry.

Friday Facts #232 - PAX, Bugs, Graphs

Posted by Twinsen, Rseding91 and Posila on 2018-03-02

Hello, it has been extremely cold these last weeks. It's one of those weeks when we can't think of anything to write about. So we will try to write some small parts.

Friday Facts #81 - Chain signals

Posted by kovarex on 2015-04-10

Hello hello,

Friday Facts #134 - Signal placement indicator

Posted by kovarex on 2016-04-15

Hello Factorio players!

Friday Facts #33 - Announcements

Posted by Tomas on 2014-05-09

Hi guys, the week since releasing the trailer has been a ride. We have got great feedback about the video, lots the requests to make a youtube coverage or blog preview of Factorio and the general awareness of the game is rising. The hedgehog (our mascot) is extremely happy about all this (or maybe its the spring).

Friday Facts #438 - Space Age wrap up

Posted by Albert, Donione, kovarex on 2024-11-22

Hello, It has been a month since the Space Age release and things are settling into a steady state. It is a good time to wrap things up, and discuss our future plans.

Friday Facts #114 - Better train conditions

Posted by kovarex on 2015-11-27

Hello, it feels really nice these weeks. We actually have some time to improve the game instead of just fixing bugs. Lets take a look on some of the improvements.

Friday Facts #125 - Achievements

Posted by kovarex on 2016-02-12

Hello, we spent one whole day by playtesting the 0.12 multiplayer. To my surprise, we didn't encounter any problems so we are just few small bugfixes far from the 0.12.23 which will be probably the version used on steam. I thought how experienced and good we are when we managed to make pretty big factory in just 8 hours, but once I saw the Factorio world record speedrun I don't think so any more :)

Friday Facts #99 - MP forwarding

Posted by Tomas on 2015-08-14

Good day to all, it is hot here. Really hot. We have loosened our "dressing policy" to "no T-shirt is fine". Both of our fans are running full speed and the fridge is stacked with ice cube plates. People come and go all the time - it is the mids of vacation period after all. Half empty (or half full) office has become a standard these days. Still the work goes on and there is progress.